home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / comm / cnet / codebreaker.lha / CodeBreaker
Encoding:
Text File  |  1993-06-06  |  1.1 KB  |  48 lines

  1. /*
  2.  */
  3. bufferflush;options results;path="RAM:";signal on ioerr;signal on error;signal on syntax
  4. wtim=10;ltim=-10
  5. main0:
  6. transmit "z5c3 -+- Code Breaker! v1.0 -+- z0"
  7. code1=random(1,9,time('s'))
  8. code2=random(1,9,time('s'))
  9. code3=random(1,9,time('s'))
  10. tries=0
  11. guess:
  12. tries=tries+1
  13. if tries>7 then do;transmit "c1Too many tries!";signal lose;end
  14. guess1:
  15. transmit "c2Guess #c7"tries
  16. query "c4Enter 3 digit code: c7"
  17. cg=result
  18. if left(cg,1,)="#" then signal quit
  19. if length(cg)<3 then do;transmit "c1Not enough Numbers!";signal guess1;end
  20. x1=substr(cg,1,1);x2=substr(cg,2,1);x3=substr(cg,3,1);rt=0
  21. codea:
  22. if x1=code1 then rt=rt+1
  23. if x2=code2 then rt=rt+1
  24. if x3=code3 then rt=rt+1
  25. transmit "c2You Guessed c3"rt"c2 Number(s) right!"
  26. if rt=3 then do;transmit "z7c4 You Guessed the number! z0";signal win;end
  27. signal guess
  28.  
  29. win:
  30. Transmit "n1c3You won "wtim" Minutes!"
  31. addtime wtim
  32. exit
  33.  
  34. lose:
  35. transmit "n1c3You lost "ltim" Minutes!n1"
  36. transmit "c5the Number wasc7 "code1 code2 code3
  37. addtime ltim
  38. exit
  39.  
  40. quit:
  41. exit
  42.  
  43. ioerr:
  44. syntax:
  45. error:
  46. transmit "Error on line "sigl
  47. exit
  48.